﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using DAO;
using DTO;
using System.Windows.Forms;

namespace BaiTap1
{
    public partial class frm_TimKhachHang : Form
    {
        public bool _from_other;
        public int _ma_khach_hang;
        public frm_TimKhachHang()
        {
            InitializeComponent();
            LoadData();
        }
        public void LoadData()
        {
            khachHangDTOBindingSource.DataSource = KhachHang_DAO.SelectAll();
        }

        private void button2_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void KhachHang_DTODataGridView_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            int index = e.RowIndex;
            if (_from_other && index >= 0)
            {
                object obj = KhachHang_DTODataGridView[0, index].Value;
                if (obj != null)
                {
                    _ma_khach_hang = (int)obj;
                    this.Close();
                }
            }
        }
    }
}
